package com.example.es_promotion.controller;

import com.example.es_promotion.entity.CartItem;
import com.example.es_promotion.entity.Promotion;
import com.example.es_promotion.service.PromotionService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/cart/promotions")
@RequiredArgsConstructor
public class CartPromotionController {
    
    private final PromotionService promotionService;
    
    @PostMapping("/match")
    public List<Promotion> getMatchingPromotions(@RequestBody List<CartItem> cartItems) {
        return promotionService.getCartPromotions(cartItems);
    }
}